﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace ClassAdd
{
    class ClassGenerator
    {       

        public void Generate(String pathToWrite, String pathToTemplate, String className, String nameSpace, String tableName)
        {
            DBmanager dbManager = new DBmanager();
            dbManager.getVaiables(tableName);

            String listOfVariables = "";
                for (int i =0; i<dbManager.listOfVariables.Count; i++)
                {
                    listOfVariables +="public " + dbManager.listOfVariables[i] + " { get; set; }\n\t";
                }
            
            ModelClassDescription modelClassDescription = new ModelClassDescription();
            modelClassDescription.writeClass(className, nameSpace, pathToWrite, pathToTemplate, listOfVariables, tableName);

            ControlClassDescription controlClassDescription = new ControlClassDescription();
            controlClassDescription.writeClass(className, nameSpace, pathToWrite, pathToTemplate);

            ViewClassDescription viewClassDescription = new ViewClassDescription();
            viewClassDescription.writeClass(className, nameSpace, pathToWrite, pathToTemplate, tableName);

        }

    }
}


